<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QDir Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QDir Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QDir class provides access to directory structures and their
contents. <a href="#details">More...</a></p>

<h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qdir.html#Filter-enum">Filter</a></b> { Dirs, Files, Drives, NoSymLinks, ..., NoDotDot }</li><li><div class="fn" />class <b><a href="qdir-filters.html">Filters</a></b></li><li><div class="fn" />enum <b><a href="qdir.html#SortFlag-enum">SortFlag</a></b> { Name, Time, Size, Unsorted, ..., NoSort }</li><li><div class="fn" />class <b><a href="qdir-sortflags.html">SortFlags</a></b></li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qdir.html#QDir">__init__</a></b> (<i>self</i>, QDir)</li><li><div class="fn" /><b><a href="qdir.html#QDir-2">__init__</a></b> (<i>self</i>, QString&#160;<i>path</i>&#160;=&#160;QString())</li><li><div class="fn" /><b><a href="qdir.html#QDir-3">__init__</a></b> (<i>self</i>, QString&#160;<i>path</i>, QString&#160;<i>nameFilter</i>, SortFlags&#160;<i>sort</i>&#160;=&#160;QDir.Name|QDir.IgnoreCase, Filters&#160;<i>filters</i>&#160;=&#160;QDir.AllEntries)</li><li><div class="fn" />QString <b><a href="qdir.html#absoluteFilePath">absoluteFilePath</a></b> (<i>self</i>, QString&#160;<i>fileName</i>)</li><li><div class="fn" />QString <b><a href="qdir.html#absolutePath">absolutePath</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qdir.html#canonicalPath">canonicalPath</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#cd">cd</a></b> (<i>self</i>, QString&#160;<i>dirName</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#cdUp">cdUp</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qdir.html#count">count</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qdir.html#dirName">dirName</a></b> (<i>self</i>)</li><li><div class="fn" />list-of-QFileInfo <b><a href="qdir.html#entryInfoList">entryInfoList</a></b> (<i>self</i>, Filters&#160;<i>filters</i>&#160;=&#160;QDir.NoFilter, SortFlags&#160;<i>sort</i>&#160;=&#160;QDir.NoSort)</li><li><div class="fn" />list-of-QFileInfo <b><a href="qdir.html#entryInfoList-2">entryInfoList</a></b> (<i>self</i>, QStringList&#160;<i>nameFilters</i>, Filters&#160;<i>filters</i>&#160;=&#160;QDir.NoFilter, SortFlags&#160;<i>sort</i>&#160;=&#160;QDir.NoSort)</li><li><div class="fn" />QStringList <b><a href="qdir.html#entryList">entryList</a></b> (<i>self</i>, Filters&#160;<i>filters</i>&#160;=&#160;QDir.NoFilter, SortFlags&#160;<i>sort</i>&#160;=&#160;QDir.NoSort)</li><li><div class="fn" />QStringList <b><a href="qdir.html#entryList-2">entryList</a></b> (<i>self</i>, QStringList&#160;<i>nameFilters</i>, Filters&#160;<i>filters</i>&#160;=&#160;QDir.NoFilter, SortFlags&#160;<i>sort</i>&#160;=&#160;QDir.NoSort)</li><li><div class="fn" />bool <b><a href="qdir.html#exists">exists</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#exists-2">exists</a></b> (<i>self</i>, QString&#160;<i>name</i>)</li><li><div class="fn" />QString <b><a href="qdir.html#filePath">filePath</a></b> (<i>self</i>, QString&#160;<i>fileName</i>)</li><li><div class="fn" />Filters <b><a href="qdir.html#filter">filter</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#isAbsolute">isAbsolute</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#isReadable">isReadable</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#isRelative">isRelative</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#isRoot">isRoot</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#makeAbsolute">makeAbsolute</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#mkdir">mkdir</a></b> (<i>self</i>, QString&#160;<i>dirName</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#mkpath">mkpath</a></b> (<i>self</i>, QString&#160;<i>dirPath</i>)</li><li><div class="fn" />QStringList <b><a href="qdir.html#nameFilters">nameFilters</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qdir.html#path">path</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qdir.html#refresh">refresh</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qdir.html#relativeFilePath">relativeFilePath</a></b> (<i>self</i>, QString&#160;<i>fileName</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#remove">remove</a></b> (<i>self</i>, QString&#160;<i>fileName</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#rename">rename</a></b> (<i>self</i>, QString&#160;<i>oldName</i>, QString&#160;<i>newName</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#rmdir">rmdir</a></b> (<i>self</i>, QString&#160;<i>dirName</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#rmpath">rmpath</a></b> (<i>self</i>, QString&#160;<i>dirPath</i>)</li><li><div class="fn" /><b><a href="qdir.html#setFilter">setFilter</a></b> (<i>self</i>, Filters&#160;<i>filter</i>)</li><li><div class="fn" /><b><a href="qdir.html#setNameFilters">setNameFilters</a></b> (<i>self</i>, QStringList&#160;<i>nameFilters</i>)</li><li><div class="fn" /><b><a href="qdir.html#setPath">setPath</a></b> (<i>self</i>, QString&#160;<i>path</i>)</li><li><div class="fn" /><b><a href="qdir.html#setSorting">setSorting</a></b> (<i>self</i>, SortFlags&#160;<i>sort</i>)</li><li><div class="fn" />SortFlags <b><a href="qdir.html#sorting">sorting</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" /><b><a href="qdir.html#addResourceSearchPath">addResourceSearchPath</a></b> (QString&#160;<i>path</i>)</li><li><div class="fn" /><b><a href="qdir.html#addSearchPath">addSearchPath</a></b> (QString&#160;<i>prefix</i>, QString&#160;<i>path</i>)</li><li><div class="fn" />QString <b><a href="qdir.html#cleanPath">cleanPath</a></b> (QString&#160;<i>path</i>)</li><li><div class="fn" />QString <b><a href="qdir.html#convertSeparators">convertSeparators</a></b> (QString&#160;<i>pathName</i>)</li><li><div class="fn" />QDir <b><a href="qdir.html#current">current</a></b> ()</li><li><div class="fn" />QString <b><a href="qdir.html#currentPath">currentPath</a></b> ()</li><li><div class="fn" />list-of-QFileInfo <b><a href="qdir.html#drives">drives</a></b> ()</li><li><div class="fn" />QString <b><a href="qdir.html#fromNativeSeparators">fromNativeSeparators</a></b> (QString&#160;<i>pathName</i>)</li><li><div class="fn" />QDir <b><a href="qdir.html#home">home</a></b> ()</li><li><div class="fn" />QString <b><a href="qdir.html#homePath">homePath</a></b> ()</li><li><div class="fn" />bool <b><a href="qdir.html#isAbsolutePath">isAbsolutePath</a></b> (QString&#160;<i>path</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#isRelativePath">isRelativePath</a></b> (QString&#160;<i>path</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#match">match</a></b> (QStringList&#160;<i>filters</i>, QString&#160;<i>fileName</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#match-2">match</a></b> (QString&#160;<i>filter</i>, QString&#160;<i>fileName</i>)</li><li><div class="fn" />QStringList <b><a href="qdir.html#nameFiltersFromString">nameFiltersFromString</a></b> (QString&#160;<i>nameFilter</i>)</li><li><div class="fn" />QDir <b><a href="qdir.html#root">root</a></b> ()</li><li><div class="fn" />QString <b><a href="qdir.html#rootPath">rootPath</a></b> ()</li><li><div class="fn" />QStringList <b><a href="qdir.html#searchPaths">searchPaths</a></b> (QString&#160;<i>prefix</i>)</li><li><div class="fn" />QChar <b><a href="qdir.html#separator">separator</a></b> ()</li><li><div class="fn" />bool <b><a href="qdir.html#setCurrent">setCurrent</a></b> (QString&#160;<i>path</i>)</li><li><div class="fn" /><b><a href="qdir.html#setSearchPaths">setSearchPaths</a></b> (QString&#160;<i>prefix</i>, QStringList&#160;<i>searchPaths</i>)</li><li><div class="fn" />QDir <b><a href="qdir.html#temp">temp</a></b> ()</li><li><div class="fn" />QString <b><a href="qdir.html#tempPath">tempPath</a></b> ()</li><li><div class="fn" />QString <b><a href="qdir.html#toNativeSeparators">toNativeSeparators</a></b> (QString&#160;<i>pathName</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />int <b><a href="qdir.html#__contains__">__contains__</a></b> (<i>self</i>, QString)</li><li><div class="fn" />bool <b><a href="qdir.html#__eq__">__eq__</a></b> (<i>self</i>, QDir&#160;<i>dir</i>)</li><li><div class="fn" />QString <b><a href="qdir.html#__getitem__">__getitem__</a></b> (<i>self</i>, int)</li><li><div class="fn" />QStringList <b><a href="qdir.html#__getitem__-2">__getitem__</a></b> (<i>self</i>, slice)</li><li><div class="fn" /> <b><a href="qdir.html#__len__">__len__</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#__ne__">__ne__</a></b> (<i>self</i>, QDir&#160;<i>dir</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QDir class provides access to directory structures and their
contents.</p>
<p>A QDir is used to manipulate path names, access information
regarding paths and files, and manipulate the underlying file
system. It can also be used to access Qt's <a href="resources.html#resource-system">resource system</a>.</p>
<p>Qt uses "/" as a universal directory separator in the same way
that "/" is used as a path separator in URLs. If you always use "/"
as a directory separator, Qt will translate your paths to conform
to the underlying operating system.</p>
<p>A QDir can point to a file using either a relative or an
absolute path. Absolute paths begin with the directory separator
(optionally preceded by a drive specification under Windows).
Relative file names begin with a directory name or a file name and
specify a path relative to the current directory.</p>
<p>Examples of absolute paths:</p>
<pre class="cpp">
 <span class="type">QDir</span>(<span class="string">"/home/user/Documents"</span>)
 <span class="type">QDir</span>(<span class="string">"C:/Documents and Settings"</span>)
</pre>
<p>On Windows, the second example above will be translated to
<tt>C:\Documents and Settings</tt> when used to access files.</p>
<p>Examples of relative paths:</p>
<pre class="cpp">
 <span class="type">QDir</span>(<span class="string">"images/landscape.png"</span>)
</pre>
<p>You can use the <a href="qdir.html#isRelative">isRelative</a>()
or <a href="qdir.html#isAbsolute">isAbsolute</a>() functions to
check if a QDir is using a relative or an absolute file path. Call
<a href="qdir.html#makeAbsolute">makeAbsolute</a>() to convert a
relative QDir to an absolute one.</p>
<a id="navigation-and-directory-operations" name="navigation-and-directory-operations" />
<h3>Navigation and Directory Operations</h3>
<p>A directory's path can be obtained with the <a href="qdir.html#pathx">path</a>() function, and a new path set with the
<a href="qdir.html#setPath">setPath</a>() function. The absolute
path to a directory is found by calling <a href="qdir.html#absolutePath">absolutePath</a>().</p>
<p>The name of a directory is found using the <a href="qdir.html#dirName">dirName</a>() function. This typically returns
the last element in the absolute path that specifies the location
of the directory. However, it can also return "." if the QDir
represents the current directory.</p>
<pre class="cpp">
 <span class="type">QDir</span>(<span class="string">"Documents/Letters/Applications"</span>)<span class="operator">.</span>dirName() <span class="comment">// "Applications"</span>
 <span class="type">QDir</span>()<span class="operator">.</span>dirName()                                 <span class="comment">// "."</span>
</pre>
<p>The path for a directory can also be changed with the <a href="qdir.html#cd">cd</a>() and <a href="qdir.html#cdUp">cdUp</a>()
functions, both of which operate like familiar shell commands. When
<a href="qdir.html#cd">cd</a>() is called with the name of an
existing directory, the QDir object changes directory so that it
represents that directory instead. The <a href="qdir.html#cdUp">cdUp</a>() function changes the directory of the
QDir object so that it refers to its parent directory; i.e.
cd("..") is equivalent to <a href="qdir.html#cdUp">cdUp</a>().</p>
<p>Directories can be created with <a href="qdir.html#mkdir">mkdir</a>(), renamed with <a href="qdir.html#rename">rename</a>(), and removed with <a href="qdir.html#rmdir">rmdir</a>().</p>
<p>You can test for the presence of a directory with a given name
by using <a href="qdir.html#exists">exists</a>(), and the
properties of a directory can be tested with <a href="qdir.html#isReadable">isReadable</a>(), <a href="qdir.html#isAbsolute">isAbsolute</a>(), <a href="qdir.html#isRelative">isRelative</a>(), and <a href="qdir.html#isRoot">isRoot</a>().</p>
<p>The <a href="qdir.html#refresh">refresh</a>() function re-reads
the directory's data from disk.</p>
<a id="files-and-directory-contents" name="files-and-directory-contents" />
<h3>Files and Directory Contents</h3>
<p>Directories contain a number of entries, representing files,
directories, and symbolic links. The number of entries in a
directory is returned by <a href="qdir.html#count">count</a>(). A
string list of the names of all the entries in a directory can be
obtained with <a href="qdir.html#entryList">entryList</a>(). If you
need information about each entry, use <a href="qdir.html#entryInfoList">entryInfoList</a>() to obtain a list of
<a href="qfileinfo.html">QFileInfo</a> objects.</p>
<p>Paths to files and directories within a directory can be
constructed using <a href="qdir.html#filePath">filePath</a>() and
<a href="qdir.html#absoluteFilePath">absoluteFilePath</a>(). The
<a href="qdir.html#filePath">filePath</a>() function returns a path
to the specified file or directory relative to the path of the QDir
object; <a href="qdir.html#absoluteFilePath">absoluteFilePath</a>()
returns an absolute path to the specified file or directory.
Neither of these functions checks for the existence of files or
directory; they only construct paths.</p>
<pre class="cpp">
 <span class="type">QDir</span> directory(<span class="string">"Documents/Letters"</span>);
 <span class="type"><a href="qstring.html">QString</a></span> path <span class="operator">=</span> directory<span class="operator">.</span>filePath(<span class="string">"contents.txt"</span>);
 <span class="type"><a href="qstring.html">QString</a></span> absolutePath <span class="operator">=</span> directory<span class="operator">.</span>absoluteFilePath(<span class="string">"contents.txt"</span>);
</pre>
<p>Files can be removed by using the <a href="qdir.html#remove">remove</a>() function. Directories cannot be
removed in the same way as files; use <a href="qdir.html#rmdir">rmdir</a>() to remove them instead.</p>
<p>It is possible to reduce the number of entries returned by
<a href="qdir.html#entryList">entryList</a>() and <a href="qdir.html#entryInfoList">entryInfoList</a>() by applying filters
to a QDir object. You can apply a name filter to specify a pattern
with wildcards that file names need to match, an attribute filter
that selects properties of entries and can distinguish between
files and directories, and a sort order.</p>
<p>Name filters are lists of strings that are passed to <a href="qdir.html#setNameFilters">setNameFilters</a>(). Attribute filters
consist of a bitwise OR combination of Filters, and these are
specified when calling <a href="qdir.html#setFilter">setFilter</a>(). The sort order is specified
using <a href="qdir.html#setSorting">setSorting</a>() with a
bitwise OR combination of <a href="qdir.html#SortFlag-enum">SortFlags</a>.</p>
<p>You can test to see if a filename matches a filter using the
<a href="qdir.html#match">match</a>() function.</p>
<p>Filter and sort order flags may also be specified when calling
<a href="qdir.html#entryList">entryList</a>() and <a href="qdir.html#entryInfoList">entryInfoList</a>() in order to override
previously defined behavior.</p>
<a id="the-current-directory-and-other-special-paths" name="the-current-directory-and-other-special-paths" />
<h3>The Current Directory and Other Special Paths</h3>
<p>Access to some common directories is provided with a number of
static functions that return QDir objects. There are also
corresponding functions for these that return strings:</p>
<table class="generic">
<thead>
<tr class="qt-style">
<th>QDir</th>
<th><a href="qstring.html">QString</a></th>
<th>Return Value</th>
</tr>
</thead>
<tr class="odd" valign="top">
<td><a href="qdir.html#current">current</a>()</td>
<td><a href="qdir.html#currentPath">currentPath</a>()</td>
<td>The application's working directory</td>
</tr>
<tr class="even" valign="top">
<td><a href="qdir.html#home">home</a>()</td>
<td><a href="qdir.html#homePath">homePath</a>()</td>
<td>The user's home directory</td>
</tr>
<tr class="odd" valign="top">
<td><a href="qdir.html#root">root</a>()</td>
<td><a href="qdir.html#rootPath">rootPath</a>()</td>
<td>The root directory</td>
</tr>
<tr class="even" valign="top">
<td><a href="qdir.html#temp">temp</a>()</td>
<td><a href="qdir.html#tempPath">tempPath</a>()</td>
<td>The system's temporary directory</td>
</tr>
</table>
<p>The <a href="qdir.html#setCurrent">setCurrent</a>() static
function can also be used to set the application's working
directory.</p>
<p>If you want to find the directory containing the application's
executable, see <a href="qcoreapplication.html#applicationDirPath">QCoreApplication.applicationDirPath</a>().</p>
<p>The <a href="qdir.html#drives">drives</a>() static function
provides a list of root directories for each device that contains a
filing system. On Unix systems this returns a list containing a
single root directory "/"; on Windows the list will usually contain
<tt>C:/</tt>, and possibly other drive letters such as
<tt>D:/</tt>, depending on the configuration of the user's
system.</p>
<a id="path-manipulation-and-strings" name="path-manipulation-and-strings" />
<h3>Path Manipulation and Strings</h3>
<p>Paths containing "." elements that reference the current
directory at that point in the path, ".." elements that reference
the parent directory, and symbolic links can be reduced to a
canonical form using the <a href="qdir.html#canonicalPath">canonicalPath</a>() function.</p>
<p>Paths can also be simplified by using <a href="qdir.html#cleanPath">cleanPath</a>() to remove redundant "/" and
".." elements.</p>
<p>It is sometimes necessary to be able to show a path in the
native representation for the user's platform. The static <a href="qdir.html#toNativeSeparators">toNativeSeparators</a>() function
returns a copy of the specified path in which each directory
separator is replaced by the appropriate separator for the
underlying operating system.</p>
<a id="examples" name="examples" />
<h3>Examples</h3>
<p>Check if a directory exists:</p>
<pre class="cpp">
 <span class="type">QDir</span> dir(<span class="string">"example"</span>);
 <span class="keyword">if</span> (<span class="operator">!</span>dir<span class="operator">.</span>exists())
     <a href="qtcore.html#qWarning">qWarning</a>(<span class="string">"Cannot find the example directory"</span>);
</pre>
<p>(We could also use the static convenience function <a href="qfile.html#exists">QFile.exists</a>().)</p>
<p>Traversing directories and reading a file:</p>
<pre class="cpp">
 <span class="type">QDir</span> dir <span class="operator">=</span> <span class="type">QDir</span><span class="operator">.</span>root();                 <span class="comment">// "/"</span>
 <span class="keyword">if</span> (<span class="operator">!</span>dir<span class="operator">.</span>cd(<span class="string">"tmp"</span>)) {                    <span class="comment">// "/tmp"</span>
     <a href="qtcore.html#qWarning">qWarning</a>(<span class="string">"Cannot find the \"/tmp\" directory"</span>);
 } <span class="keyword">else</span> {
     <span class="type"><a href="qfile.html">QFile</a></span> file(dir<span class="operator">.</span>filePath(<span class="string">"ex1.txt"</span>)); <span class="comment">// "/tmp/ex1.txt"</span>
     <span class="keyword">if</span> (<span class="operator">!</span>file<span class="operator">.</span>open(<span class="type"><a href="qiodevice.html">QIODevice</a></span><span class="operator">.</span>ReadWrite))
         <a href="qtcore.html#qWarning">qWarning</a>(<span class="string">"Cannot create the file %s"</span><span class="operator">,</span> file<span class="operator">.</span>name());
 }
</pre>
<p>A program that lists all the files in the current directory
(excluding symbolic links), sorted by size, smallest first:</p>
<pre class="cpp">
 <span class="preprocessor">#include &lt;QDir&gt;</span>
 <span class="preprocessor">#include &lt;iostream&gt;</span>

 <span class="type">int</span> main(<span class="type">int</span> argc<span class="operator">,</span> <span class="type">char</span> <span class="operator">*</span>argv<span class="operator">[</span><span class="operator">]</span>)
 {
     <span class="type"><a href="qcoreapplication.html">QCoreApplication</a></span> app(argc<span class="operator">,</span> argv);
     <span class="type">QDir</span> dir;
     dir<span class="operator">.</span>setFilter(<span class="type">QDir</span><span class="operator">.</span>Files <span class="operator">|</span> <span class="type">QDir</span><span class="operator">.</span>Hidden <span class="operator">|</span> <span class="type">QDir</span><span class="operator">.</span>NoSymLinks);
     dir<span class="operator">.</span>setSorting(<span class="type">QDir</span><span class="operator">.</span>Size <span class="operator">|</span> <span class="type">QDir</span><span class="operator">.</span>Reversed);

     <span class="type"><a href="qfileinfo.html#QFileInfoList-typedef">QFileInfoList</a></span> list <span class="operator">=</span> dir<span class="operator">.</span>entryInfoList();
     std<span class="operator">.</span>cout <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">"     Bytes Filename"</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> std<span class="operator">.</span>endl;
     <span class="keyword">for</span> (<span class="type">int</span> i <span class="operator">=</span> <span class="number">0</span>; i <span class="operator">&lt;</span> list<span class="operator">.</span>size(); <span class="operator">+</span><span class="operator">+</span>i) {
         <span class="type"><a href="qfileinfo.html">QFileInfo</a></span> fileInfo <span class="operator">=</span> list<span class="operator">.</span>at(i);
         std<span class="operator">.</span>cout <span class="operator">&lt;</span><span class="operator">&lt;</span> <a href="qtcore.html#qPrintable">qPrintable</a>(<span class="type"><a href="qstring.html">QString</a></span>(<span class="string">"%1 %2"</span>)<span class="operator">.</span>arg(fileInfo<span class="operator">.</span>size()<span class="operator">,</span> <span class="number">10</span>)
                                                 <span class="operator">.</span>arg(fileInfo<span class="operator">.</span>fileName()));
         std<span class="operator">.</span>cout <span class="operator">&lt;</span><span class="operator">&lt;</span> std<span class="operator">.</span>endl;
     }
     <span class="keyword">return</span> <span class="number">0</span>;
 }
</pre><hr /><h2>Type Documentation</h2><h3 class="fn"><a name="Filter-enum" />QDir.Filter</h3><p>This enum describes the filtering options available to <a href="qdir.html">QDir</a>; e.g. for <a href="qdir.html#entryList">entryList</a>() and <a href="qdir.html#entryInfoList">entryInfoList</a>(). The filter value is
specified by combining values from the following list using the
bitwise OR operator:</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QDir.Dirs</tt></td>
<td class="topAlign"><tt>0x001</tt></td>
<td class="topAlign">List directories that match the filters.</td>
</tr>
<tr>
<td class="topAlign"><tt>QDir.AllDirs</tt></td>
<td class="topAlign"><tt>0x400</tt></td>
<td class="topAlign">List all directories; i.e. don't apply the
filters to directory names.</td>
</tr>
<tr>
<td class="topAlign"><tt>QDir.Files</tt></td>
<td class="topAlign"><tt>0x002</tt></td>
<td class="topAlign">List files.</td>
</tr>
<tr>
<td class="topAlign"><tt>QDir.Drives</tt></td>
<td class="topAlign"><tt>0x004</tt></td>
<td class="topAlign">List disk drives (ignored under Unix).</td>
</tr>
<tr>
<td class="topAlign"><tt>QDir.NoSymLinks</tt></td>
<td class="topAlign"><tt>0x008</tt></td>
<td class="topAlign">Do not list symbolic links (ignored by
operating systems that don't support symbolic links).</td>
</tr>
<tr>
<td class="topAlign"><tt>QDir.NoDotAndDotDot</tt></td>
<td class="topAlign"><tt>0x1000</tt></td>
<td class="topAlign">Do not list the special entries "." and
"..".</td>
</tr>
<tr>
<td class="topAlign"><tt>QDir.NoDot</tt></td>
<td class="topAlign"><tt>0x2000</tt></td>
<td class="topAlign">Do not list the special entry ".".</td>
</tr>
<tr>
<td class="topAlign"><tt>QDir.NoDotDot</tt></td>
<td class="topAlign"><tt>0x4000</tt></td>
<td class="topAlign">Do not list the special entry "..".</td>
</tr>
<tr>
<td class="topAlign"><tt>QDir.AllEntries</tt></td>
<td class="topAlign"><tt>Dirs | Files | Drives</tt></td>
<td class="topAlign">List directories, files, drives and symlinks
(this does not list broken symlinks unless you specify
System).</td>
</tr>
<tr>
<td class="topAlign"><tt>QDir.Readable</tt></td>
<td class="topAlign"><tt>0x010</tt></td>
<td class="topAlign">List files for which the application has read
access. The Readable value needs to be combined with Dirs or
Files.</td>
</tr>
<tr>
<td class="topAlign"><tt>QDir.Writable</tt></td>
<td class="topAlign"><tt>0x020</tt></td>
<td class="topAlign">List files for which the application has write
access. The Writable value needs to be combined with Dirs or
Files.</td>
</tr>
<tr>
<td class="topAlign"><tt>QDir.Executable</tt></td>
<td class="topAlign"><tt>0x040</tt></td>
<td class="topAlign">List files for which the application has
execute access. The Executable value needs to be combined with Dirs
or Files.</td>
</tr>
<tr>
<td class="topAlign"><tt>QDir.Modified</tt></td>
<td class="topAlign"><tt>0x080</tt></td>
<td class="topAlign">Only list files that have been modified
(ignored on Unix).</td>
</tr>
<tr>
<td class="topAlign"><tt>QDir.Hidden</tt></td>
<td class="topAlign"><tt>0x100</tt></td>
<td class="topAlign">List hidden files (on Unix, files starting
with a ".").</td>
</tr>
<tr>
<td class="topAlign"><tt>QDir.System</tt></td>
<td class="topAlign"><tt>0x200</tt></td>
<td class="topAlign">List system files (on Unix, FIFOs, sockets and
device files are included; on Windows, <tt>.lnk</tt> files are
included)</td>
</tr>
<tr>
<td class="topAlign"><tt>QDir.CaseSensitive</tt></td>
<td class="topAlign"><tt>0x800</tt></td>
<td class="topAlign">The filter should be case sensitive.</td>
</tr>
</table>
<p>Functions that use Filter enum values to filter lists of files
and directories will include symbolic links to files and
directories unless you set the NoSymLinks value.</p>
<p>A default constructed <a href="qdir.html">QDir</a> will not
filter out files based on their permissions, so <a href="qdir.html#entryList">entryList</a>() and <a href="qdir.html#entryInfoList">entryInfoList</a>() will return all files
that are readable, writable, executable, or any combination of the
three. This makes the default easy to write, and at the same time
useful.</p>
<p>For example, setting the <tt>Readable</tt>, <tt>Writable</tt>,
and <tt>Files</tt> flags allows all files to be listed for which
the application has read access, write access or both. If the
<tt>Dirs</tt> and <tt>Drives</tt> flags are also included in this
combination then all drives, directories, all files that the
application can read, write, or execute, and symlinks to such
files/directories can be listed.</p>
<p>To retrieve the permissons for a directory, use the <a href="qdir.html#entryInfoList">entryInfoList</a>() function to get the
associated <a href="qfileinfo.html">QFileInfo</a> objects and then
use the QFileInfo.permissons() to obtain the permissions and
ownership for each file.</p>
<p>The Filters type is a typedef for <a href="qflags.html">QFlags</a>&lt;Filter&gt;. It stores an OR combination
of Filter values.</p>


<h3 class="fn"><a name="SortFlag-enum" />QDir.SortFlag</h3><p>This enum describes the sort options available to <a href="qdir.html">QDir</a>, e.g. for <a href="qdir.html#entryList">entryList</a>() and <a href="qdir.html#entryInfoList">entryInfoList</a>(). The sort value is
specified by OR-ing together values from the following list:</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QDir.Name</tt></td>
<td class="topAlign"><tt>0x00</tt></td>
<td class="topAlign">Sort by name.</td>
</tr>
<tr>
<td class="topAlign"><tt>QDir.Time</tt></td>
<td class="topAlign"><tt>0x01</tt></td>
<td class="topAlign">Sort by time (modification time).</td>
</tr>
<tr>
<td class="topAlign"><tt>QDir.Size</tt></td>
<td class="topAlign"><tt>0x02</tt></td>
<td class="topAlign">Sort by file size.</td>
</tr>
<tr>
<td class="topAlign"><tt>QDir.Type</tt></td>
<td class="topAlign"><tt>0x80</tt></td>
<td class="topAlign">Sort by file type (extension).</td>
</tr>
<tr>
<td class="topAlign"><tt>QDir.Unsorted</tt></td>
<td class="topAlign"><tt>0x03</tt></td>
<td class="topAlign">Do not sort.</td>
</tr>
<tr>
<td class="topAlign"><tt>QDir.NoSort</tt></td>
<td class="topAlign"><tt>-1</tt></td>
<td class="topAlign">Not sorted by default.</td>
</tr>
<tr>
<td class="topAlign"><tt>QDir.DirsFirst</tt></td>
<td class="topAlign"><tt>0x04</tt></td>
<td class="topAlign">Put the directories first, then the
files.</td>
</tr>
<tr>
<td class="topAlign"><tt>QDir.DirsLast</tt></td>
<td class="topAlign"><tt>0x20</tt></td>
<td class="topAlign">Put the files first, then the
directories.</td>
</tr>
<tr>
<td class="topAlign"><tt>QDir.Reversed</tt></td>
<td class="topAlign"><tt>0x08</tt></td>
<td class="topAlign">Reverse the sort order.</td>
</tr>
<tr>
<td class="topAlign"><tt>QDir.IgnoreCase</tt></td>
<td class="topAlign"><tt>0x10</tt></td>
<td class="topAlign">Sort case-insensitively.</td>
</tr>
<tr>
<td class="topAlign"><tt>QDir.LocaleAware</tt></td>
<td class="topAlign"><tt>0x40</tt></td>
<td class="topAlign">Sort items appropriately using the current
locale settings.</td>
</tr>
</table>
<p>You can only specify one of the first four.</p>
<p>If you specify both DirsFirst and Reversed, directories are
still put first, but in reverse order; the files will be listed
after the directories, again in reverse order.</p>
<p>The SortFlags type is a typedef for <a href="qflags.html">QFlags</a>&lt;SortFlag&gt;. It stores an OR
combination of SortFlag values.</p>


<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QDir" />QDir.__init__ (<i>self</i>, <a href="qdir.html">QDir</a>)</h3><p>Constructs a <a href="qdir.html">QDir</a> object that is a copy
of the <a href="qdir.html">QDir</a> object for directory
<i>dir</i>.</p>
<p><b>See also</b> <a href="qdir.html#operator-eq">operator=</a>().</p>


<h3 class="fn"><a name="QDir-2" />QDir.__init__ (<i>self</i>, QString&#160;<i>path</i>&#160;=&#160;QString())</h3><p>Constructs a <a href="qdir.html">QDir</a> pointing to the given
directory <i>path</i>. If path is empty the program's working
directory, ("."), is used.</p>
<p><b>See also</b> <a href="qdir.html#currentPath">currentPath</a>().</p>


<h3 class="fn"><a name="QDir-3" />QDir.__init__ (<i>self</i>, QString&#160;<i>path</i>, QString&#160;<i>nameFilter</i>, <a href="qdir-sortflags.html">SortFlags</a>&#160;<i>sort</i>&#160;=&#160;QDir.Name|QDir.IgnoreCase, <a href="qdir-filters.html">Filters</a>&#160;<i>filters</i>&#160;=&#160;QDir.AllEntries)</h3><p>Constructs a <a href="qdir.html">QDir</a> with path <i>path</i>,
that filters its entries by name using <i>nameFilter</i> and by
attributes using <i>filters</i>. It also sorts the names using
<i>sort</i>.</p>
<p>The default <i>nameFilter</i> is an empty string, which excludes
nothing; the default <i>filters</i> is <a href="qdir.html#Filter-enum">AllEntries</a>, which also means exclude
nothing. The default <i>sort</i> is <a href="qdir.html#SortFlag-enum">Name</a> | <a href="qdir.html#SortFlag-enum">IgnoreCase</a>, i.e. sort by name
case-insensitively.</p>
<p>If <i>path</i> is an empty string, <a href="qdir.html">QDir</a>
uses "." (the current directory). If <i>nameFilter</i> is an empty
string, <a href="qdir.html">QDir</a> uses the name filter "*" (all
files).</p>
<p>Note that <i>path</i> need not exist.</p>
<p><b>See also</b> <a href="qdir.html#exists">exists</a>(),
<a href="qdir.html#setPath">setPath</a>(), <a class="compat" href="qdir-qt3.html#setNameFilter">setNameFilter</a>(),
<a href="qdir.html#setFilter">setFilter</a>(), and <a href="qdir.html#setSorting">setSorting</a>().</p>


<h3 class="fn"><a name="absoluteFilePath" />QString QDir.absoluteFilePath (<i>self</i>, QString&#160;<i>fileName</i>)</h3><p>Returns the absolute path name of a file in the directory. Does
<i>not</i> check if the file actually exists in the directory; but
see <a href="qdir.html#exists">exists</a>(). Redundant multiple
separators or "." and ".." directories in <i>fileName</i> are not
removed (see <a href="qdir.html#cleanPath">cleanPath</a>()).</p>
<p><b>See also</b> <a href="qdir.html#relativeFilePath">relativeFilePath</a>(), <a href="qdir.html#filePath">filePath</a>(), and <a href="qdir.html#canonicalPath">canonicalPath</a>().</p>


<h3 class="fn"><a name="absolutePath" />QString QDir.absolutePath (<i>self</i>)</h3><p>Returns the absolute path (a path that starts with "/" or with a
drive specification), which may contain symbolic links, but never
contains redundant ".", ".." or multiple separators.</p>
<p><b>See also</b> <a href="qdir.html#setPath">setPath</a>(),
<a href="qdir.html#canonicalPath">canonicalPath</a>(), <a href="qdir.html#exists">exists</a>(), <a href="qdir.html#cleanPath">cleanPath</a>(), <a href="qdir.html#dirName">dirName</a>(), and <a href="qdir.html#absoluteFilePath">absoluteFilePath</a>().</p>


<h3 class="fn"><a name="addResourceSearchPath" />QDir.addResourceSearchPath (QString&#160;<i>path</i>)</h3><h3 class="fn"><a name="addSearchPath" />QDir.addSearchPath (QString&#160;<i>prefix</i>, QString&#160;<i>path</i>)</h3><p>Adds <i>path</i> to the search path for <i>prefix</i>.</p>
<p>This function was introduced in Qt 4.3.</p>
<p><b>See also</b> <a href="qdir.html#setSearchPaths">setSearchPaths</a>().</p>


<h3 class="fn"><a name="canonicalPath" />QString QDir.canonicalPath (<i>self</i>)</h3><p>Returns the canonical path, i.e. a path without symbolic links
or redundant "." or ".." elements.</p>
<p>On systems that do not have symbolic links this function will
always return the same string that <a href="qdir.html#absolutePath">absolutePath</a>() returns. If the
canonical path does not exist (normally due to dangling symbolic
links) canonicalPath() returns an empty string.</p>
<p>Example:</p>
<pre class="cpp">
 <span class="type"><a href="qstring.html">QString</a></span> bin <span class="operator">=</span> <span class="string">"/local/bin"</span>;         <span class="comment">// where /local/bin is a symlink to /usr/bin</span>
 <span class="type"><a href="qdir.html">QDir</a></span> binDir(bin);
 <span class="type"><a href="qstring.html">QString</a></span> canonicalBin <span class="operator">=</span> binDir<span class="operator">.</span>canonicalPath();
 <span class="comment">// canonicalBin now equals "/usr/bin"</span>

 <span class="type"><a href="qstring.html">QString</a></span> ls <span class="operator">=</span> <span class="string">"/local/bin/ls"</span>;       <span class="comment">// where ls is the executable "ls"</span>
 <span class="type"><a href="qdir.html">QDir</a></span> lsDir(ls);
 <span class="type"><a href="qstring.html">QString</a></span> canonicalLs <span class="operator">=</span> lsDir<span class="operator">.</span>canonicalPath();
 <span class="comment">// canonicalLS now equals "/usr/bin/ls".</span>
</pre>
<p><b>See also</b> <a href="qdir.html#pathx">path</a>(), <a href="qdir.html#absolutePath">absolutePath</a>(), <a href="qdir.html#exists">exists</a>(), <a href="qdir.html#cleanPath">cleanPath</a>(), <a href="qdir.html#dirName">dirName</a>(), and <a href="qdir.html#absoluteFilePath">absoluteFilePath</a>().</p>


<h3 class="fn"><a name="cd" />bool QDir.cd (<i>self</i>, QString&#160;<i>dirName</i>)</h3><p>Changes the <a href="qdir.html">QDir</a>'s directory to
<i>dirName</i>.</p>
<p>Returns true if the new directory exists and is readable;
otherwise returns false. Note that the logical cd() operation is
not performed if the new directory does not exist.</p>
<p>Calling cd("..") is equivalent to calling <a href="qdir.html#cdUp">cdUp</a>().</p>
<p><b>See also</b> <a href="qdir.html#cdUp">cdUp</a>(), <a href="qdir.html#isReadable">isReadable</a>(), <a href="qdir.html#exists">exists</a>(), and <a href="qdir.html#pathx">path</a>().</p>


<h3 class="fn"><a name="cdUp" />bool QDir.cdUp (<i>self</i>)</h3><p>Changes directory by moving one directory up from the <a href="qdir.html">QDir</a>'s current directory.</p>
<p>Returns true if the new directory exists and is readable;
otherwise returns false. Note that the logical cdUp() operation is
not performed if the new directory does not exist.</p>
<p><b>See also</b> <a href="qdir.html#cd">cd</a>(), <a href="qdir.html#isReadable">isReadable</a>(), <a href="qdir.html#exists">exists</a>(), and <a href="qdir.html#pathx">path</a>().</p>


<h3 class="fn"><a name="cleanPath" />QString QDir.cleanPath (QString&#160;<i>path</i>)</h3><p>Removes all multiple directory separators "/" and resolves any
"."s or ".."s found in the path, <i>path</i>.</p>
<p>Symbolic links are kept. This function does not return the
canonical path, but rather the simplest version of the input. For
example, "./local" becomes "local", "local/../bin" becomes "bin"
and "/local/usr/../bin" becomes "/local/bin".</p>
<p><b>See also</b> <a href="qdir.html#absolutePath">absolutePath</a>() and <a href="qdir.html#canonicalPath">canonicalPath</a>().</p>


<h3 class="fn"><a name="convertSeparators" />QString QDir.convertSeparators (QString&#160;<i>pathName</i>)</h3><h3 class="fn"><a name="count" />int QDir.count (<i>self</i>)</h3><p>Returns the total number of directories and files in the
directory.</p>
<p>Equivalent to <a href="qdir.html#entryList">entryList</a>().count().</p>
<p><b>See also</b> <a href="qdir.html#operator-5b-5d">operator[]</a>() and <a href="qdir.html#entryList">entryList</a>().</p>


<h3 class="fn"><a name="current" /><a href="qdir.html">QDir</a> QDir.current ()</h3><p>Returns the application's current directory.</p>
<p>The directory is constructed using the absolute path of the
current directory, ensuring that its <a href="qdir.html#pathx">path</a>() will be the same as its <a href="qdir.html#absolutePath">absolutePath</a>().</p>
<p><b>See also</b> <a href="qdir.html#currentPath">currentPath</a>(), <a href="qdir.html#setCurrent">setCurrent</a>(), <a href="qdir.html#home">home</a>(), <a href="qdir.html#root">root</a>(),
and <a href="qdir.html#temp">temp</a>().</p>


<h3 class="fn"><a name="currentPath" />QString QDir.currentPath ()</h3><p>Returns the absolute path of the application's current
directory.</p>
<p><b>See also</b> <a href="qdir.html#current">current</a>(),
<a href="qdir.html#setCurrent">setCurrent</a>(), <a href="qdir.html#homePath">homePath</a>(), <a href="qdir.html#rootPath">rootPath</a>(), and <a href="qdir.html#tempPath">tempPath</a>().</p>


<h3 class="fn"><a name="dirName" />QString QDir.dirName (<i>self</i>)</h3><p>Returns the name of the directory; this is <i>not</i> the same
as the path, e.g. a directory with the name "mail", might have the
path "/var/spool/mail". If the directory has no name (e.g. it is
the root directory) an empty string is returned.</p>
<p>No check is made to ensure that a directory with this name
actually exists; but see <a href="qdir.html#exists">exists</a>().</p>
<p><b>See also</b> <a href="qdir.html#pathx">path</a>(), <a href="qdir.html#filePath">filePath</a>(), <a href="qdir.html#absolutePath">absolutePath</a>(), and <a href="qdir.html#absoluteFilePath">absoluteFilePath</a>().</p>


<h3 class="fn"><a name="drives" />list-of-QFileInfo QDir.drives ()</h3><p>Returns a list of the root directories on this system.</p>
<p>On Windows this returns a list of <a href="qfileinfo.html">QFileInfo</a> objects containing "C:/", "D:/",
etc. On other operating systems, it returns a list containing just
one root directory (i.e. "/").</p>
<p><b>See also</b> <a href="qdir.html#root">root</a>() and <a href="qdir.html#rootPath">rootPath</a>().</p>


<h3 class="fn"><a name="entryInfoList" />list-of-QFileInfo QDir.entryInfoList (<i>self</i>, <a href="qdir-filters.html">Filters</a>&#160;<i>filters</i>&#160;=&#160;QDir.NoFilter, <a href="qdir-sortflags.html">SortFlags</a>&#160;<i>sort</i>&#160;=&#160;QDir.NoSort)</h3><p>Returns a list of <a href="qfileinfo.html">QFileInfo</a> objects
for all the files and directories in the directory, ordered
according to the name and attribute filters previously set with
<a href="qdir.html#setNameFilters">setNameFilters</a>() and
<a href="qdir.html#setFilter">setFilter</a>(), and sorted according
to the flags set with <a href="qdir.html#setSorting">setSorting</a>().</p>
<p>The name filter, file attribute filter, and sorting
specification can be overridden using the <i>nameFilters</i>,
<i>filters</i>, and <i>sort</i> arguments.</p>
<p>Returns an empty list if the directory is unreadable, does not
exist, or if nothing matches the specification.</p>
<p><b>See also</b> <a href="qdir.html#entryList">entryList</a>(),
<a href="qdir.html#setNameFilters">setNameFilters</a>(), <a href="qdir.html#setSorting">setSorting</a>(), <a href="qdir.html#setFilter">setFilter</a>(), <a href="qdir.html#isReadable">isReadable</a>(), and <a href="qdir.html#exists">exists</a>().</p>


<h3 class="fn"><a name="entryInfoList-2" />list-of-QFileInfo QDir.entryInfoList (<i>self</i>, QStringList&#160;<i>nameFilters</i>, <a href="qdir-filters.html">Filters</a>&#160;<i>filters</i>&#160;=&#160;QDir.NoFilter, <a href="qdir-sortflags.html">SortFlags</a>&#160;<i>sort</i>&#160;=&#160;QDir.NoSort)</h3><p>This is an overloaded function.</p>
<p>Returns a list of <a href="qfileinfo.html">QFileInfo</a> objects
for all the files and directories in the directory, ordered
according to the name and attribute filters previously set with
<a href="qdir.html#setNameFilters">setNameFilters</a>() and
<a href="qdir.html#setFilter">setFilter</a>(), and sorted according
to the flags set with <a href="qdir.html#setSorting">setSorting</a>().</p>
<p>The attribute filter and sorting specifications can be
overridden using the <i>filters</i> and <i>sort</i> arguments.</p>
<p>Returns an empty list if the directory is unreadable, does not
exist, or if nothing matches the specification.</p>
<p><b>See also</b> <a href="qdir.html#entryList">entryList</a>(),
<a href="qdir.html#setNameFilters">setNameFilters</a>(), <a href="qdir.html#setSorting">setSorting</a>(), <a href="qdir.html#setFilter">setFilter</a>(), <a href="qdir.html#isReadable">isReadable</a>(), and <a href="qdir.html#exists">exists</a>().</p>


<h3 class="fn"><a name="entryList" />QStringList QDir.entryList (<i>self</i>, <a href="qdir-filters.html">Filters</a>&#160;<i>filters</i>&#160;=&#160;QDir.NoFilter, <a href="qdir-sortflags.html">SortFlags</a>&#160;<i>sort</i>&#160;=&#160;QDir.NoSort)</h3><p>Returns a list of the names of all the files and directories in
the directory, ordered according to the name and attribute filters
previously set with <a href="qdir.html#setNameFilters">setNameFilters</a>() and <a href="qdir.html#setFilter">setFilter</a>(), and sorted according to the
flags set with <a href="qdir.html#setSorting">setSorting</a>().</p>
<p>The name filter, file attribute filter, and sorting
specification can be overridden using the <i>nameFilters</i>,
<i>filters</i>, and <i>sort</i> arguments.</p>
<p>Returns an empty list if the directory is unreadable, does not
exist, or if nothing matches the specification.</p>
<p><b>See also</b> <a href="qdir.html#entryInfoList">entryInfoList</a>(), <a href="qdir.html#setNameFilters">setNameFilters</a>(), <a href="qdir.html#setSorting">setSorting</a>(), and <a href="qdir.html#setFilter">setFilter</a>().</p>


<h3 class="fn"><a name="entryList-2" />QStringList QDir.entryList (<i>self</i>, QStringList&#160;<i>nameFilters</i>, <a href="qdir-filters.html">Filters</a>&#160;<i>filters</i>&#160;=&#160;QDir.NoFilter, <a href="qdir-sortflags.html">SortFlags</a>&#160;<i>sort</i>&#160;=&#160;QDir.NoSort)</h3><p>This is an overloaded function.</p>
<p>Returns a list of the names of all the files and directories in
the directory, ordered according to the name and attribute filters
previously set with <a href="qdir.html#setNameFilters">setNameFilters</a>() and <a href="qdir.html#setFilter">setFilter</a>(), and sorted according to the
flags set with <a href="qdir.html#setSorting">setSorting</a>().</p>
<p>The attribute filter and sorting specifications can be
overridden using the <i>filters</i> and <i>sort</i> arguments.</p>
<p>Returns an empty list if the directory is unreadable, does not
exist, or if nothing matches the specification.</p>
<p><b>Note:</b> To list symlinks that point to non existing files,
<a href="qdir.html#Filter-enum">System</a> must be passed to the
filter.</p>
<p><b>See also</b> <a href="qdir.html#entryInfoList">entryInfoList</a>(), <a href="qdir.html#setNameFilters">setNameFilters</a>(), <a href="qdir.html#setSorting">setSorting</a>(), and <a href="qdir.html#setFilter">setFilter</a>().</p>


<h3 class="fn"><a name="exists" />bool QDir.exists (<i>self</i>)</h3><p>Returns true if the file called <i>name</i> exists; otherwise
returns false.</p>
<p>Unless <i>name</i> contains an absolute file path, the file name
is assumed to be relative to the directory itself, so this function
is typically used to check for the presence of files within a
directory.</p>
<p><b>See also</b> <a href="qfileinfo.html#exists">QFileInfo.exists</a>() and <a href="qfile.html#exists">QFile.exists</a>().</p>


<h3 class="fn"><a name="exists-2" />bool QDir.exists (<i>self</i>, QString&#160;<i>name</i>)</h3><p>This is an overloaded function.</p>
<p>Returns true if the directory exists; otherwise returns false.
(If a file with the same name is found this function will return
false).</p>
<p>The overload of this function that accepts an argument is used
to test for the presence of files and directories within a
directory.</p>
<p><b>See also</b> <a href="qfileinfo.html#exists">QFileInfo.exists</a>() and <a href="qfile.html#exists">QFile.exists</a>().</p>


<h3 class="fn"><a name="filePath" />QString QDir.filePath (<i>self</i>, QString&#160;<i>fileName</i>)</h3><p>Returns the path name of a file in the directory. Does
<i>not</i> check if the file actually exists in the directory; but
see <a href="qdir.html#exists">exists</a>(). If the <a href="qdir.html">QDir</a> is relative the returned path name will also
be relative. Redundant multiple separators or "." and ".."
directories in <i>fileName</i> are not removed (see <a href="qdir.html#cleanPath">cleanPath</a>()).</p>
<p><b>See also</b> <a href="qdir.html#dirName">dirName</a>(),
<a href="qdir.html#absoluteFilePath">absoluteFilePath</a>(),
<a href="qdir.html#isRelative">isRelative</a>(), and <a href="qdir.html#canonicalPath">canonicalPath</a>().</p>


<h3 class="fn"><a name="filter" /><a href="qdir-filters.html">Filters</a> QDir.filter (<i>self</i>)</h3><p>Returns the value set by <a href="qdir.html#setFilter">setFilter</a>()</p>
<p><b>See also</b> <a href="qdir.html#setFilter">setFilter</a>().</p>


<h3 class="fn"><a name="fromNativeSeparators" />QString QDir.fromNativeSeparators (QString&#160;<i>pathName</i>)</h3><p>Returns <i>pathName</i> using '/' as file separator. On Windows,
for instance, fromNativeSeparators("<tt>c:\\winnt\\system32</tt>")
returns "c:/winnt/system32".</p>
<p>The returned string may be the same as the argument on some
operating systems, for example on Unix.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qdir.html#toNativeSeparators">toNativeSeparators</a>() and
<a href="qdir.html#separator">separator</a>().</p>


<h3 class="fn"><a name="home" /><a href="qdir.html">QDir</a> QDir.home ()</h3><p>Returns the user's home directory.</p>
<p>The directory is constructed using the absolute path of the home
directory, ensuring that its <a href="qdir.html#pathx">path</a>()
will be the same as its <a href="qdir.html#absolutePath">absolutePath</a>().</p>
<p>See <a href="qdir.html#homePath">homePath</a>() for details.</p>
<p><b>See also</b> <a href="qdir.html#drives">drives</a>(),
<a href="qdir.html#current">current</a>(), <a href="qdir.html#root">root</a>(), and <a href="qdir.html#temp">temp</a>().</p>


<h3 class="fn"><a name="homePath" />QString QDir.homePath ()</h3><p>Returns the absolute path of the user's home directory.</p>
<p>Under Windows this function will return the directory of the
current user's profile. Typically, this is:</p>
<pre class="cpp">
 C:<span class="operator">/</span>Documents <span class="keyword">and</span> Settings<span class="operator">/</span>Username
</pre>
<p>Use the <a href="qdir.html#toNativeSeparators">toNativeSeparators</a>() function to
convert the separators to the ones that are appropriate for the
underlying operating system.</p>
<p>If the directory of the current user's profile does not exist or
cannot be retrieved, the following alternatives will be checked (in
the given order) until an existing and available path is found:</p>
<ol class="1">
<li>The path specified by the <tt>USERPROFILE</tt> environment
variable.</li>
<li>The path formed by concatenating the <tt>HOMEDRIVE</tt> and
<tt>HOMEPATH</tt> environment variables.</li>
<li>The path specified by the <tt>HOME</tt> environment
variable.</li>
<li>The path returned by the <a href="qdir.html#rootPath">rootPath</a>() function (which uses the
<tt>SystemDrive</tt> environment variable)</li>
<li>The <tt>C:/</tt> directory.</li>
</ol>
<p>Under non-Windows operating systems the <tt>HOME</tt>
environment variable is used if it exists, otherwise the path
returned by the <a href="qdir.html#rootPath">rootPath</a>().</p>
<p>On Symbian this typically returns "c:/data", i.e. the same as
native PathInfo.PhoneMemoryRootPath().</p>
<p><b>See also</b> <a href="qdir.html#home">home</a>(), <a href="qdir.html#currentPath">currentPath</a>(), <a href="qdir.html#rootPath">rootPath</a>(), and <a href="qdir.html#tempPath">tempPath</a>().</p>


<h3 class="fn"><a name="isAbsolute" />bool QDir.isAbsolute (<i>self</i>)</h3><p>Returns true if the directory's path is absolute; otherwise
returns false. See <a href="qdir.html#isAbsolutePath">isAbsolutePath</a>().</p>
<p><b>See also</b> <a href="qdir.html#isRelative">isRelative</a>(),
<a href="qdir.html#makeAbsolute">makeAbsolute</a>(), and <a href="qdir.html#cleanPath">cleanPath</a>().</p>


<h3 class="fn"><a name="isAbsolutePath" />bool QDir.isAbsolutePath (QString&#160;<i>path</i>)</h3><p>Returns true if <i>path</i> is absolute; returns false if it is
relative.</p>
<p><b>See also</b> <a href="qdir.html#isAbsolute">isAbsolute</a>(),
<a href="qdir.html#isRelativePath">isRelativePath</a>(), <a href="qdir.html#makeAbsolute">makeAbsolute</a>(), and <a href="qdir.html#cleanPath">cleanPath</a>().</p>


<h3 class="fn"><a name="isReadable" />bool QDir.isReadable (<i>self</i>)</h3><p>Returns true if the directory is readable <i>and</i> we can open
files by name; otherwise returns false.</p>
<p><b>Warning:</b> A false value from this function is not a
guarantee that files in the directory are not accessible.</p>
<p><b>See also</b> <a href="qfileinfo.html#isReadable">QFileInfo.isReadable</a>().</p>


<h3 class="fn"><a name="isRelative" />bool QDir.isRelative (<i>self</i>)</h3><p>Returns true if the directory path is relative; otherwise
returns false. (Under Unix a path is relative if it does not start
with a "/").</p>
<p><b>See also</b> <a href="qdir.html#makeAbsolute">makeAbsolute</a>(), <a href="qdir.html#isAbsolute">isAbsolute</a>(), <a href="qdir.html#isAbsolutePath">isAbsolutePath</a>(), and <a href="qdir.html#cleanPath">cleanPath</a>().</p>


<h3 class="fn"><a name="isRelativePath" />bool QDir.isRelativePath (QString&#160;<i>path</i>)</h3><p>Returns true if <i>path</i> is relative; returns false if it is
absolute.</p>
<p><b>See also</b> <a href="qdir.html#isRelative">isRelative</a>(),
<a href="qdir.html#isAbsolutePath">isAbsolutePath</a>(), and
<a href="qdir.html#makeAbsolute">makeAbsolute</a>().</p>


<h3 class="fn"><a name="isRoot" />bool QDir.isRoot (<i>self</i>)</h3><p>Returns true if the directory is the root directory; otherwise
returns false.</p>
<p>Note: If the directory is a symbolic link to the root directory
this function returns false. If you want to test for this use
<a href="qdir.html#canonicalPath">canonicalPath</a>(), e.g.</p>
<pre class="cpp">
 <span class="type"><a href="qdir.html">QDir</a></span> dir(<span class="string">"/tmp/root_link"</span>);
 dir <span class="operator">=</span> dir<span class="operator">.</span>canonicalPath();
 <span class="keyword">if</span> (dir<span class="operator">.</span>isRoot())
     <a href="qtcore.html#qWarning">qWarning</a>(<span class="string">"It is a root link"</span>);
</pre>
<p><b>See also</b> <a href="qdir.html#root">root</a>() and <a href="qdir.html#rootPath">rootPath</a>().</p>


<h3 class="fn"><a name="makeAbsolute" />bool QDir.makeAbsolute (<i>self</i>)</h3><p>Converts the directory path to an absolute path. If it is
already absolute nothing happens. Returns true if the conversion
succeeded; otherwise returns false.</p>
<p><b>See also</b> <a href="qdir.html#isAbsolute">isAbsolute</a>(),
<a href="qdir.html#isAbsolutePath">isAbsolutePath</a>(), <a href="qdir.html#isRelative">isRelative</a>(), and <a href="qdir.html#cleanPath">cleanPath</a>().</p>


<h3 class="fn"><a name="match" />bool QDir.match (QStringList&#160;<i>filters</i>, QString&#160;<i>fileName</i>)</h3><p>Returns true if the <i>fileName</i> matches the wildcard (glob)
pattern <i>filter</i>; otherwise returns false. The <i>filter</i>
may contain multiple patterns separated by spaces or semicolons.
The matching is case insensitive.</p>
<p><b>See also</b> <a href="qregexp.html#qregexp-wildcard-matching">QRegExp wildcard
matching</a>, <a href="qregexp.html#exactMatch">QRegExp.exactMatch</a>(), <a href="qdir.html#entryList">entryList</a>(), and <a href="qdir.html#entryInfoList">entryInfoList</a>().</p>


<h3 class="fn"><a name="match-2" />bool QDir.match (QString&#160;<i>filter</i>, QString&#160;<i>fileName</i>)</h3><p>This is an overloaded function.</p>
<p>Returns true if the <i>fileName</i> matches any of the wildcard
(glob) patterns in the list of <i>filters</i>; otherwise returns
false. The matching is case insensitive.</p>
<p><b>See also</b> <a href="qregexp.html#qregexp-wildcard-matching">QRegExp wildcard
matching</a>, <a href="qregexp.html#exactMatch">QRegExp.exactMatch</a>(), <a href="qdir.html#entryList">entryList</a>(), and <a href="qdir.html#entryInfoList">entryInfoList</a>().</p>


<h3 class="fn"><a name="mkdir" />bool QDir.mkdir (<i>self</i>, QString&#160;<i>dirName</i>)</h3><p>Creates a sub-directory called <i>dirName</i>.</p>
<p>Returns true on success; otherwise returns false.</p>
<p>If the directory already exists when this function is called, it
will return false.</p>
<p><b>See also</b> <a href="qdir.html#rmdir">rmdir</a>().</p>


<h3 class="fn"><a name="mkpath" />bool QDir.mkpath (<i>self</i>, QString&#160;<i>dirPath</i>)</h3><p>Creates the directory path <i>dirPath</i>.</p>
<p>The function will create all parent directories necessary to
create the directory.</p>
<p>Returns true if successful; otherwise returns false.</p>
<p>If the path already exists when this function is called, it will
return true.</p>
<p><b>See also</b> <a href="qdir.html#rmpath">rmpath</a>().</p>


<h3 class="fn"><a name="nameFilters" />QStringList QDir.nameFilters (<i>self</i>)</h3><p>Returns the string list set by <a href="qdir.html#setNameFilters">setNameFilters</a>()</p>
<p><b>See also</b> <a href="qdir.html#setNameFilters">setNameFilters</a>().</p>


<h3 class="fn"><a name="nameFiltersFromString" />QStringList QDir.nameFiltersFromString (QString&#160;<i>nameFilter</i>)</h3><h3 class="fn"><a name="path" />QString QDir.path (<i>self</i>)</h3><h3 class="fn"><a name="refresh" />QDir.refresh (<i>self</i>)</h3><p>Refreshes the directory information.</p>


<h3 class="fn"><a name="relativeFilePath" />QString QDir.relativeFilePath (<i>self</i>, QString&#160;<i>fileName</i>)</h3><p>Returns the path to <i>fileName</i> relative to the
directory.</p>
<pre class="cpp">
 <span class="type"><a href="qdir.html">QDir</a></span> dir(<span class="string">"/home/bob"</span>);
 <span class="type"><a href="qstring.html">QString</a></span> s;

 s <span class="operator">=</span> dir<span class="operator">.</span>relativeFilePath(<span class="string">"images/file.jpg"</span>);     <span class="comment">// s is "images/file.jpg"</span>
 s <span class="operator">=</span> dir<span class="operator">.</span>relativeFilePath(<span class="string">"/home/mary/file.txt"</span>); <span class="comment">// s is "../mary/file.txt"</span>
</pre>
<p><b>See also</b> <a href="qdir.html#absoluteFilePath">absoluteFilePath</a>(), <a href="qdir.html#filePath">filePath</a>(), and <a href="qdir.html#canonicalPath">canonicalPath</a>().</p>


<h3 class="fn"><a name="remove" />bool QDir.remove (<i>self</i>, QString&#160;<i>fileName</i>)</h3><p>Removes the file, <i>fileName</i>.</p>
<p>Returns true if the file is removed successfully; otherwise
returns false.</p>


<h3 class="fn"><a name="rename" />bool QDir.rename (<i>self</i>, QString&#160;<i>oldName</i>, QString&#160;<i>newName</i>)</h3><p>Renames a file or directory from <i>oldName</i> to
<i>newName</i>, and returns true if successful; otherwise returns
false.</p>
<p>On most file systems, rename() fails only if <i>oldName</i> does
not exist, if <i>newName</i> and <i>oldName</i> are not on the same
partition or if a file with the new name already exists. However,
there are also other reasons why rename() can fail. For example, on
at least one file system rename() fails if <i>newName</i> points to
an open file.</p>


<h3 class="fn"><a name="rmdir" />bool QDir.rmdir (<i>self</i>, QString&#160;<i>dirName</i>)</h3><p>Removes the directory specified by <i>dirName</i>.</p>
<p>The directory must be empty for rmdir() to succeed.</p>
<p>Returns true if successful; otherwise returns false.</p>
<p><b>See also</b> <a href="qdir.html#mkdir">mkdir</a>().</p>


<h3 class="fn"><a name="rmpath" />bool QDir.rmpath (<i>self</i>, QString&#160;<i>dirPath</i>)</h3><p>Removes the directory path <i>dirPath</i>.</p>
<p>The function will remove all parent directories in
<i>dirPath</i>, provided that they are empty. This is the opposite
of mkpath(dirPath).</p>
<p>Returns true if successful; otherwise returns false.</p>
<p><b>See also</b> <a href="qdir.html#mkpath">mkpath</a>().</p>


<h3 class="fn"><a name="root" /><a href="qdir.html">QDir</a> QDir.root ()</h3><p>Returns the root directory.</p>
<p>The directory is constructed using the absolute path of the root
directory, ensuring that its <a href="qdir.html#pathx">path</a>()
will be the same as its <a href="qdir.html#absolutePath">absolutePath</a>().</p>
<p>See <a href="qdir.html#rootPath">rootPath</a>() for details.</p>
<p><b>See also</b> <a href="qdir.html#drives">drives</a>(),
<a href="qdir.html#current">current</a>(), <a href="qdir.html#home">home</a>(), and <a href="qdir.html#temp">temp</a>().</p>


<h3 class="fn"><a name="rootPath" />QString QDir.rootPath ()</h3><p>Returns the absolute path of the root directory.</p>
<p>For Unix operating systems this returns "/". For Windows and
Symbian file systems this normally returns "c:/". I.E. the root of
the system drive.</p>
<p><b>See also</b> <a href="qdir.html#root">root</a>(), <a href="qdir.html#drives">drives</a>(), <a href="qdir.html#currentPath">currentPath</a>(), <a href="qdir.html#homePath">homePath</a>(), and <a href="qdir.html#tempPath">tempPath</a>().</p>


<h3 class="fn"><a name="searchPaths" />QStringList QDir.searchPaths (QString&#160;<i>prefix</i>)</h3><p>Returns the search paths for <i>prefix</i>.</p>
<p>This function was introduced in Qt 4.3.</p>
<p><b>See also</b> <a href="qdir.html#setSearchPaths">setSearchPaths</a>() and <a href="qdir.html#addSearchPath">addSearchPath</a>().</p>


<h3 class="fn"><a name="separator" />QChar QDir.separator ()</h3><p>Returns the native directory separator: "/" under Unix
(including Mac OS X) and "\" under Windows.</p>
<p>You do not need to use this function to build file paths. If you
always use "/", Qt will translate your paths to conform to the
underlying operating system. If you want to display paths to the
user using their operating system's separator use <a href="qdir.html#toNativeSeparators">toNativeSeparators</a>().</p>


<h3 class="fn"><a name="setCurrent" />bool QDir.setCurrent (QString&#160;<i>path</i>)</h3><p>Sets the application's current working directory to <i>path</i>.
Returns true if the directory was successfully changed; otherwise
returns false.</p>
<p><b>See also</b> <a href="qdir.html#current">current</a>(),
<a href="qdir.html#currentPath">currentPath</a>(), <a href="qdir.html#home">home</a>(), <a href="qdir.html#root">root</a>(),
and <a href="qdir.html#temp">temp</a>().</p>


<h3 class="fn"><a name="setFilter" />QDir.setFilter (<i>self</i>, <a href="qdir-filters.html">Filters</a>&#160;<i>filter</i>)</h3><p>Sets the filter used by <a href="qdir.html#entryList">entryList</a>() and <a href="qdir.html#entryInfoList">entryInfoList</a>() to <i>filters</i>.
The filter is used to specify the kind of files that should be
returned by <a href="qdir.html#entryList">entryList</a>() and
<a href="qdir.html#entryInfoList">entryInfoList</a>(). See <a href="qdir.html#Filter-enum">QDir.Filter</a>.</p>
<p><b>See also</b> <a href="qdir.html#filter">filter</a>() and
<a href="qdir.html#setNameFilters">setNameFilters</a>().</p>


<h3 class="fn"><a name="setNameFilters" />QDir.setNameFilters (<i>self</i>, QStringList&#160;<i>nameFilters</i>)</h3><p>Sets the name filters used by <a href="qdir.html#entryList">entryList</a>() and <a href="qdir.html#entryInfoList">entryInfoList</a>() to the list of
filters specified by <i>nameFilters</i>.</p>
<p>Each name filter is a wildcard (globbing) filter that
understands <tt>*</tt> and <tt>?</tt> wildcards. (See <a href="qregexp.html#qregexp-wildcard-matching">QRegExp wildcard
matching</a>.)</p>
<p>For example, the following code sets three name filters on a
<a href="qdir.html">QDir</a> to ensure that only files with
extensions typically used for C++ source files are listed:</p>
<pre class="cpp">
     <span class="type"><a href="qstringlist.html">QStringList</a></span> filters;
     filters <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">"*.cpp"</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">"*.cxx"</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">"*.cc"</span>;
     dir<span class="operator">.</span>setNameFilters(filters);
</pre>
<p><b>See also</b> <a href="qdir.html#nameFilters">nameFilters</a>() and <a href="qdir.html#setFilter">setFilter</a>().</p>


<h3 class="fn"><a name="setPath" />QDir.setPath (<i>self</i>, QString&#160;<i>path</i>)</h3><p>Sets the path of the directory to <i>path</i>. The path is
cleaned of redundant ".", ".." and of multiple separators. No check
is made to see whether a directory with this path actually exists;
but you can check for yourself using <a href="qdir.html#exists">exists</a>().</p>
<p>The path can be either absolute or relative. Absolute paths
begin with the directory separator "/" (optionally preceded by a
drive specification under Windows). Relative file names begin with
a directory name or a file name and specify a path relative to the
current directory. An example of an absolute path is the string
"/tmp/quartz", a relative path might look like "src/fatlib".</p>
<p><b>See also</b> <a href="qdir.html#pathx">path</a>(), <a href="qdir.html#absolutePath">absolutePath</a>(), <a href="qdir.html#exists">exists</a>(), <a href="qdir.html#cleanPath">cleanPath</a>(), <a href="qdir.html#dirName">dirName</a>(), <a href="qdir.html#absoluteFilePath">absoluteFilePath</a>(), <a href="qdir.html#isRelative">isRelative</a>(), and <a href="qdir.html#makeAbsolute">makeAbsolute</a>().</p>


<h3 class="fn"><a name="setSearchPaths" />QDir.setSearchPaths (QString&#160;<i>prefix</i>, QStringList&#160;<i>searchPaths</i>)</h3><p>Sets or replaces Qt's search paths for file names with the
prefix <i>prefix</i> to <i>searchPaths</i>.</p>
<p>To specify a prefix for a file name, prepend the prefix followed
by a single colon (e.g., "images:undo.png", "xmldocs:books.xml").
<i>prefix</i> can only contain letters or numbers (e.g., it cannot
contain a colon, nor a slash).</p>
<p>Qt uses this search path to locate files with a known prefix.
The search path entries are tested in order, starting with the
first entry.</p>
<pre class="cpp">
 <span class="type"><a href="qdir.html">QDir</a></span><span class="operator">.</span>setSearchPaths(<span class="string">"icons"</span><span class="operator">,</span> <span class="type"><a href="qstringlist.html">QStringList</a></span>(<span class="type"><a href="qdir.html">QDir</a></span><span class="operator">.</span>homePath() <span class="operator">+</span> <span class="string">"/images"</span>));
 <span class="type"><a href="qdir.html">QDir</a></span><span class="operator">.</span>setSearchPaths(<span class="string">"docs"</span><span class="operator">,</span> <span class="type"><a href="qstringlist.html">QStringList</a></span>(<span class="string">":/embeddedDocuments"</span>));
 <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
 <span class="type"><a href="qpixmap.html">QPixmap</a></span> pixmap(<span class="string">"icons:undo.png"</span>); <span class="comment">// will look for undo.png in QDir.homePath() + "/images"</span>
 <span class="type"><a href="qfile.html">QFile</a></span> file(<span class="string">"docs:design.odf"</span>); <span class="comment">// will look in the :/embeddedDocuments resource path</span>
</pre>
<p>File name prefix must be at least 2 characters long to avoid
conflicts with Windows drive letters.</p>
<p>Search paths may contain paths to <a href="resources.html">The
Qt Resource System</a>.</p>
<p>This function was introduced in Qt 4.3.</p>
<p><b>See also</b> <a href="qdir.html#searchPaths">searchPaths</a>().</p>


<h3 class="fn"><a name="setSorting" />QDir.setSorting (<i>self</i>, <a href="qdir-sortflags.html">SortFlags</a>&#160;<i>sort</i>)</h3><p>Sets the sort order used by <a href="qdir.html#entryList">entryList</a>() and <a href="qdir.html#entryInfoList">entryInfoList</a>().</p>
<p>The <i>sort</i> is specified by OR-ing values from the enum
<a href="qdir.html#SortFlag-enum">QDir.SortFlag</a>.</p>
<p><b>See also</b> <a href="qdir.html#sorting">sorting</a>() and
<a href="qdir.html#SortFlag-enum">SortFlag</a>.</p>


<h3 class="fn"><a name="sorting" /><a href="qdir-sortflags.html">SortFlags</a> QDir.sorting (<i>self</i>)</h3><p>Returns the value set by <a href="qdir.html#setSorting">setSorting</a>()</p>
<p><b>See also</b> <a href="qdir.html#setSorting">setSorting</a>()
and <a href="qdir.html#SortFlag-enum">SortFlag</a>.</p>


<h3 class="fn"><a name="temp" /><a href="qdir.html">QDir</a> QDir.temp ()</h3><p>Returns the system's temporary directory.</p>
<p>The directory is constructed using the absolute path of the
temporary directory, ensuring that its <a href="qdir.html#pathx">path</a>() will be the same as its <a href="qdir.html#absolutePath">absolutePath</a>().</p>
<p>See <a href="qdir.html#tempPath">tempPath</a>() for details.</p>
<p><b>See also</b> <a href="qdir.html#drives">drives</a>(),
<a href="qdir.html#current">current</a>(), <a href="qdir.html#home">home</a>(), and <a href="qdir.html#root">root</a>().</p>


<h3 class="fn"><a name="tempPath" />QString QDir.tempPath ()</h3><p>Returns the absolute path of the system's temporary
directory.</p>
<p>On Unix/Linux systems this is the path in the <tt>TMPDIR</tt>
environment variable or <tt>/tmp</tt> if <tt>TMPDIR</tt> is not
defined. On Windows this is usually the path in the <tt>TEMP</tt>
or <tt>TMP</tt> environment variable. Whether a directory separator
is added to the end or not, depends on the operating system.</p>
<p><b>See also</b> <a href="qdir.html#temp">temp</a>(), <a href="qdir.html#currentPath">currentPath</a>(), <a href="qdir.html#homePath">homePath</a>(), and <a href="qdir.html#rootPath">rootPath</a>().</p>


<h3 class="fn"><a name="toNativeSeparators" />QString QDir.toNativeSeparators (QString&#160;<i>pathName</i>)</h3><p>Returns <i>pathName</i> with the '/' separators converted to
separators that are appropriate for the underlying operating
system.</p>
<p>On Windows, toNativeSeparators("c:/winnt/system32") returns
"c:\winnt\system32".</p>
<p>The returned string may be the same as the argument on some
operating systems, for example on Unix.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qdir.html#fromNativeSeparators">fromNativeSeparators</a>() and
<a href="qdir.html#separator">separator</a>().</p>


<h3 class="fn"><a name="__contains__" />int QDir.__contains__ (<i>self</i>, QString)</h3><h3 class="fn"><a name="__eq__" />bool QDir.__eq__ (<i>self</i>, <a href="qdir.html">QDir</a>&#160;<i>dir</i>)</h3><h3 class="fn"><a name="__getitem__" />QString QDir.__getitem__ (<i>self</i>, int)</h3><h3 class="fn"><a name="__getitem__-2" />QStringList QDir.__getitem__ (<i>self</i>, slice)</h3><h3 class="fn"><a name="__len__" /> QDir.__len__ (<i>self</i>)</h3><h3 class="fn"><a name="__ne__" />bool QDir.__ne__ (<i>self</i>, <a href="qdir.html">QDir</a>&#160;<i>dir</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;snapshot-4.9.5-9eb6aac99275 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.3</td></tr></table></div></address></body></html>